#求两个数及其之间的数的总和

#/bin/bash
sum=0
i=0

if [ $# -lt 2 ]
then
	echo "请输入参数"
	
	else
		if [ $1 -eq $2 ]
		then
		echo "和为$1"
		elif [ $1 -lt $2 ]
		then
			while [ $i -le $[$2-$1]  ]
			do
				sum=$[$sum+$[$1+$i]]
				i=$[$i+1]
			done
			echo "和为：$sum"
		else 
		while [ $i -le $[$1-$2]  ]
			do
				sum=$[$sum+$[$2+$i]]
				i=$[$i+1]
			done
			echo "和为：$sum"
		fi
fi





